package byteStream;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class InputStream2 {
	public static void main(String[] args) throws IOException {
		File file1=new File("c:/mytxt.txt");
		File file2=new File("d:/mytxt.txt");
		p(file2.createNewFile());
		InputStream is=new FileInputStream(file1);
		OutputStream os=new FileOutputStream(file1,true);
		for (int i = 0; i < is.available(); i++) {
            int a=is.read();
            p(a);
			os.write(a);
		}
	}
    static void p(Object o){
    	System.out.println(o);
    }
}
